package learner;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;

import learner.hmm.Movement;
import learner.hmm.MovementVector;


public class Pattern {

	private static final int MIN_NUM_SKIPS_IN_SKIPPING = 2;
	private List<ObservationPoint> points = new ArrayList<ObservationPoint>();

	public List<ObservationPoint> getPoints() {
		return points;
	}
	
	public Pattern() {
		
	}
	
	public Pattern(List<ObservationPoint> points) {
		this.points = points;
	}
	
	public Pattern append(Pattern pattern) {
		if (points == null) points = new ArrayList<ObservationPoint>();
		List<ObservationPoint> allPoints = new ArrayList<ObservationPoint>(points);
		if (pattern.points != null)
			allPoints.addAll(pattern.points);
		return new Pattern(allPoints);
	}
	
	

	

	@Override
	public String toString() {
		return "Pattern [points=" + points + "]";
	}
	
	//heeft dit voldoende skips om te kunnen spreken van doelbewust skippen?
	public boolean containsSomeSkips(){
		Movement movement = new Movement(this);
		int nbSkips =0;
		for(MovementVector move: movement.getMovementVectors()){
			if(move.isSkip()){
				nbSkips++;
			}
		}
		if(nbSkips>=MIN_NUM_SKIPS_IN_SKIPPING)
			return true;
		return false;
	}
}
